package com.swust.book_shop.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @author liushuai
 * @create 2022-05-04 23:22
 */
@Configuration
public class Swagger2Config {
    @Bean
    public Docket docket(){
        Docket docket = new Docket(DocumentationType.SWAGGER_2);
        ApiInfoBuilder apiInfoBuilder = new ApiInfoBuilder();
        ApiInfo apiInfo = apiInfoBuilder.title("西科大二手图书商城接口文档")
                .description("用于获取西科大二手图书商城接口数据")
                .version("1.0")
                .build();
        docket.select().apis(RequestHandlerSelectors.basePackage("com.swust.book_shop.controller"))
                .paths(PathSelectors.any()).build();
        Docket docket1 = docket.apiInfo(apiInfo);
        return docket1;
    }
}
